package cn.webrx;

import java.util.Calendar;
import java.util.Locale;

public class StringFromat1 {
    public static void main(String[] args) {
        for (int i = 0; i < 10; i++) {
            String num = String.format("%03d ", i);
            System.out.print(num);
        }
        System.out.println();

        System.out.println(String.format("%.3f", 100f));
        System.out.printf("%.3f%n", 100f);

        Calendar c = Calendar.getInstance();
        //c.set(Calendar.YEAR,1985);
        //c.set(1985, 10 - 1, 12);
        String infous = String.format(Locale.US,"%tA",c);
        System.out.println(infous);

        String infocn = String.format(Locale.CHINA,"%tA",c);
        System.out.println(infocn);
        //System.out.printf("%tA%n",c);

        System.out.println(String.format("%2$S %s %<S","abc","hello"));
        System.out.printf("%2$S %s %<S%n","abc","hello");


        Locale.setDefault(Locale.UK);
        System.out.println(String.format(Locale.UK,"%tz%n",System.currentTimeMillis()));


        //七月十二日
        System.out.printf("%tm月%<td日%n",System.currentTimeMillis());
    }
}
